package org.andhy.formeasy.core;

import java.util.HashSet;
import java.util.Set;


public class ValidateItem {
	private String name;
	private boolean required = true;
	
	private Pipeline pipeline;
	
	public String getName(){
		return name;
	}
	
	public void setName(String name){
		this.name = name;
	}

	public void setPipeline(Pipeline pipeline) {
		this.pipeline = pipeline;
	}

	public Pipeline getPipeline() {
		return pipeline;
	}
	
	public Set<String> validate(Object value){
		Set<String> msgHold = new HashSet<String>();
		pipeline.invoke(value, msgHold);
		return msgHold;
	}

	public void setRequired(boolean required) {
		this.required = required;
	}

	public boolean isRequired() {
		return required;
	}
}
